#ifndef _GPU_TRACER_H_
#define _GPU_TRACER_H_

#include "gvariable.h"
#include "gprogram.h"

class GPUTracer
{
public: // methods
	GPUTracer(int w, int h);
	~GPUTracer();
	void init();
	void update();
	void rotateX(float angle);
	void rotateY(float angle);
	void zoom(float delta);
	void display();
	void setSource(std::string szSource) {szShaderFamily = szSource;};

protected:
	int				iWidth, iHeight; 

	float*			pData;

	float			rotMatrix[16];
	float			rotMatrixInv[16];
	float			fRotX, fRotY;
	int				nTime, nFrame, nTimeBase;

	unsigned int	iTexture[2];

	std::string		szShaderFamily;

	GLint			iTex1ID;
	GLint			iTex2ID;

	CGProgram		pIsec;
	CGProgram		pShading;

	CGVariable		pRay;
	CGVariable		pRayInv;
	CGVariable		pRayShade;
	CGVariable		pRayTime;
	CGVariable		pOpacitySwitch;
	CGVariable		pLightSwitch;
	CGVariable		pShadowsSwitch;

private:
	void copyTexture(int nIndex);
	void fpsCounter();
	void renderQuad(int nSubdivision, int nTextures = 1, float z = 0.0f);
};
#endif
